#ifndef EYEBROW_NODE
#define EYEBROW_NODE

#include <ros/ros.h>
#include <threemxl/C3mxlROS.h>
#include <XMLConfiguration.h>
#include <threemxl/dxlassert.h>
#include <cmath>
#include "std_msgs/Float32.h"
#include "topic/topic.h"
#include "comm/eyebrows_msg.h"
#include "config.h"

#define EYEBROW_SPEED	M_PI	// half circle in a second

class EyebrowNode
{
private:
	ros::NodeHandle nh_;
	ros::Subscriber motor_sub_;
	ros::Publisher status_pub_;

	LxSerial serial_port_;	// serial port interface
	C3mxlROS *motor_;

	int eyebrows_cstate;	// current state
	int eyebrows_fstate;	// final state

	double motor_pos;	// position of the motor in rad
public:
	EyebrowNode();
	~EyebrowNode();

	/**
	 * Moves the motors to the start position.
	 */
	void extInit();

	/**
	 * Handle incoming messages for the eyebrows.
	 * @param	msg	expected state for the eyebrow.
	 */
	void eyebrowCallback(const comm::eyebrows::ConstPtr &msg);

	/**
	 * Initialize motor parameters.
	 */
	void init();

	/**
	 * Spin node.
	 */
	void spin();
};


#endif
